// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.

import 'package:flutter_test/flutter_test.dart';

void main() async {
  var initialUrl = "http://百家号.baidu.com/s?id=9255&json=%7b%22zhangsan%22%3a%22%e6%9d%8e%e5%9b%9b%22%7d"
      "&chain=哈哈哈";

  RegExp reg = new RegExp(r"[\u4e00-\u9fa5]+");
  Iterable<Match> matches = reg.allMatches(initialUrl);
  for (Match m in matches) {
    initialUrl = initialUrl.replaceAll(m.group(0), Uri.encodeFull(m.group(0)));
    print('$initialUrl');
    print('${Uri.decodeFull(initialUrl)}');
  }

  var map = Uri.splitQueryString(initialUrl);
  print("$map");
}

foo() async {
  print('foo E');
  String value = await bar();
  print('foo X $value');
}

Future<String> bar() async {
  return Future.delayed(new Duration(seconds: 2), () {
    print("bar E");
    return "hello";
  });
}
